﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Bdcs.Core.Entity
{
    /// <summary>
    /// Adv_UserDept数据模型对象
    /// </summary>
    [Serializable]
    public partial class Adv_UserDeptMod : IEntity, IEntityTypeBuilder<Adv_UserDeptMod>
    {
        
		//属性存储数据的变量
        private string _userID;
        private string _companyID;
        
        /// <summary>
        /// UserID
        /// </summary>
        public string UserID
        {
            get { return this._userID; }
            set { this._userID = value; }
        }
        /// <summary>
        /// CompanyID
        /// </summary>
        public string CompanyID
        {
            get { return this._companyID; }
            set { this._companyID = value; }
        }
        
        /// <summary>
        /// 对比两个Adv_UserDept数据模型对象是否一致
        /// </summary>
        /// <param name="obj">要进行比对的Adv_UserDept数据模型对象</param>
        /// <returns>返回是否一致，为true一致，为false不一致</returns>
        public override bool Equals(object obj)
        {
            //判断传入对象是否为null
            if (obj == null) return false;
            //将传入对象转换成Adv_UserDept数据模型对象
            Adv_UserDeptMod adv_UserDeptMod = obj as Adv_UserDeptMod;
            //判断是否转换成功
            if (adv_UserDeptMod == null) return false;
            //进行匹配属性的值
            return
                //判断UserID是否一致
                this.UserID == adv_UserDeptMod.UserID &&
                //判断CompanyID是否一致
                this.CompanyID == adv_UserDeptMod.CompanyID;
        }
        /// <summary>
        /// 将当前Adv_UserDept数据模型对象转换成哈希码
        /// </summary>
        /// <returns>哈希值</returns>
        public override int GetHashCode()
        {
            //将Adv_UserDept数据模型对象的属性进行按位异或运算处理得到哈希码并返回
            return
                //将UserID进行按位异或运算处理
                (this.UserID == null ? 2147483647 : this.UserID.GetHashCode()) ^
                //将CompanyID进行按位异或运算处理
                (this.CompanyID == null ? 2147483647 : this.CompanyID.GetHashCode());
        }
        /// <summary>
        /// 将当前Adv_UserDept数据模型对象转换成字符串副本【仅显示在SQL中不能为空的列】
        /// </summary>
        /// <returns>字符串形式副本</returns>
        public override string ToString()
        {
            //将当前Adv_UserDept数据模型对象转换成字符串副本
            return
                "[" +
                //将UserID转换成字符串
                this.UserID + "," +
                //将CompanyID转换成字符串
                this.CompanyID +
                "]";
        }

        public void Configure(EntityTypeBuilder<Adv_UserDeptMod> entityBuilder, DbContext dbContext, Type dbContextLocator)
        {
            entityBuilder.ToTable("Adv_UserDept");
            entityBuilder.HasComment("部门管理");
            entityBuilder.HasKey(e => e.UserID);
        }
    }
}
